
package com.onstar.cn.api.v2;

import com.onstar.cn.api.framework.ClazzInjectUtils;
import com.onstar.cn.api.framework.annotation.Path;
import com.onstar.cn.api.framework.annotation.PathParams;
import com.onstar.cn.api.framework.annotation.RequestMapping;
import com.onstar.cn.framework.network.entity.RequestEntity;
import com.onstar.cn.mag.dealer.MaintenanceDealerEntity;

/**
 * @author Xiaofeng Feng
 * @Title: DealersService.java
 * @date 2015年8月11日 下午2:15:18
 */
@Path("/msp/api/v3/user")
public class DealersService {

    private String serverURL;

    /**
     * @Description: TODO
     * @author Xiaofeng Feng
     * @date 2015年8月11日 下午2:15:18
     */
    public DealersService(String serverURL) {
        this.serverURL = serverURL;
    }


    /**
     * @Title: DealersService @Description:
     * /msp/api/v3/user/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/ maintenance/order
     * request method:PUT @param 设定文件 @return void
     * 返回类型 @throws
     */
    @RequestMapping("/subscriber/{idpID}/accounts/{accountID}/vehicles/{vin}/maintenance/order")
    public RequestEntity getMaintenanceOrder(RequestEntity entity, @PathParams("idpID") String subscriberID,
                                             @PathParams("accountID") String accountID, @PathParams("vin") String vin, MaintenanceDealerEntity dealerEntity) {
        if (entity == null) {
            entity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getMaintenanceOrder", entity, subscriberID, accountID, vin, dealerEntity);
//        if (dealerEntity != null) {
//            String json = JsonUtils.toJson(dealerEntity);
//            Log.d("test", "json:" + json);
//            entity.setBody(JsonUtils.toJson(dealerEntity));
//        }
        entity.setUrl(serverURL + url + "?vin=" + vin);
        return entity;
    }


}

